package thingtest.game;

import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class MouseControl implements MouseMotionListener,MouseListener{

	//private Scenario scenario;
	private GameModel model;
	private boolean playerAlreadyShot;

	public MouseControl(GameModel model){
		
		this.model = model;
		this.playerAlreadyShot = false;
		//this.scenario = model.getScenario();
	}


	@Override
	public void mouseDragged(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseMoved(MouseEvent event) {
		
		Player player = this.model.getPlayer();
		//Player player = this.scenario.playerContained();

		Vector vector = new Vector(event.getX() , event.getY());
		
		player.lookTowards(vector);
		
	}


	@Override
	public void mouseClicked(MouseEvent event) {

		
	}


	@Override
	public void mouseEntered(MouseEvent event) {

		
	}


	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}


	@Override
	public void mousePressed(MouseEvent event) {
		
		
		Player player = this.model.getScenario().playerContained();
		if (!playerAlreadyShot) player.shoot();
		playerAlreadyShot = true;

		
	}


	@Override
	public void mouseReleased(MouseEvent event) {

		playerAlreadyShot = false;
	}


}
